global stock, foundation, equal, currentsel, getlist, godlist, basecard, leftlist, rightlist
on beginSprite me
if listp(foundation) = 0 then
foundation = [:]
end if
row = determinerow()
foundation.addProp(row, new(script("card pile")))
end
on determinerow me
if spriteNum = 29 then
return #fone
else
if spriteNum = 30 then
return #ftwo
else
if spriteNum = 31 then
return #fthree
else
if spriteNum = 32 then
return #ffour
else
if spriteNum = 33 then
return #ffive
else
if spriteNum = 34 then
return #fsix
else
if spriteNum = 35 then
return #fseven
else
if spriteNum = 36 then
return #feight
end if
end if
end if
end if
end if
end if
end if
end if
end
on mouseEnter me
if getlist <> VOID then
if foundation[row].getcardcount() < 13 then
if (row = #fone) or (row = #ftwo) or (row = #fthree) or (row = #ffour) then
if not listp(leftlist) then
leftlist = []
end if
if sprite(spriteNum - 8).member.name = "empty" then
if (getlist.getlastcard().rankvalue = (basecard.rankvalue + 1)) and not leftlist.findPos(getlist.getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
end if
else
if (getlist.getlastcard().rankvalue = (foundation[row].getlastcard().rankvalue + 1)) and (getlist.getlastcard().suit = foundation[row].getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
else
if (getlist.getlastcard().rank = "ace") and (foundation[row].getlastcard().rank = "king") and (getlist.getlastcard().suit = foundation[row].getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
end if
end if
end if
else
if (row = #ffive) or (row = #fsix) or (row = #fseven) or (row = #feight) then
if not listp(rightlist) then
rightlist = []
end if
if sprite(spriteNum - 8).member.name = "empty" then
if (getlist.getlastcard().rankvalue = (basecard.rankvalue - 1)) and not rightlist.findPos(getlist.getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
end if
else
if (getlist.getlastcard().rankvalue = (foundation[row].getlastcard().rankvalue - 1)) and (getlist.getlastcard().suit = foundation[row].getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
else
if (getlist.getlastcard().rank = "king") and (foundation[row].getlastcard().rank = "ace") and (getlist.getlastcard().suit = foundation[row].getlastcard().suit) then
equal = 1
godlist = foundation[row]
currentsel = spriteNum - 8
end if
end if
end if
end if
end if
end if
end if
end
on mouseLeave me
equal = 0
currentsel = 0
godlist = VOID
end
on golem me
if foundation[row].getcardcount() = 1 then
if (row = #fone) or (row = #ftwo) or (row = #fthree) or (row = #ffour) then
if not leftlist.findPos(foundation[row].cards[1].suit) then
leftlist.add(foundation[row].cards[1].suit)
end if
else
if (row = #ffive) or (row = #fsix) or (row = #fseven) or (row = #feight) then
if not rightlist.findPos(foundation[row].cards[1].suit) then